package main

import "fmt"

type Tool struct{}

//尝试定义一个结构体方法
func (t *Tool) printLn(any string) {
	fmt.Println(any)
}
func (t Tool) printLn2(any string) {
	fmt.Println(any)
}

func printLn(any string) {
	fmt.Println(any)
}
func main() {
	var arr = [5]int{1: 1, 3: 3}
	var arrStr = [5]string{1: "s1", 3: "s3"}
	var arrBool = [3]bool{0: false, 2: true}
	var tool Tool
	fmt.Println(arr)
	//fmt.Println(&arr)
	//for循环
	printLn("遍历数字数组")
	for i, v := range arr {
		fmt.Printf("arr第%d个的值：%d\n", i, v)
	}
	notice := "遍历字符串数组"
	tool.printLn(notice)
	tool.printLn2(notice)
	tool.printLn("遍历字符串数组")
	for i, v := range arrStr {
		fmt.Printf("arrStr第%d个的值：%s\n", i, v)
	}
	tool.printLn2("遍历boolean数组")
	for i, v := range arrBool {
		fmt.Printf("arrBool第%d个的值：%v\n", i, v)
	}
}
